import { find } from 'lodash';


export const getTableColumns = ({ params }: { params: any }) => [
	{
		title: "模板名称",
		dataIndex: "name",
		width: 140,
		ellipsis: true
	},
	{
		title: "模板地址",
		dataIndex: "url",
		width: 140,
		ellipsis: true,
		render: (_: any, record: any) => {
			return (
				<a href={record?.url} target={'_blank'}>
					{ record?.url }
				</a>
			)
		}
	},
	{
		title: "能否删除",
		dataIndex: "beDeletedName",
		width: 100,
		ellipsis: true
	},
	{
		title: "备注",
		dataIndex: "remark",
		width: 140,
		ellipsis: true
	}
];

export const USER_STATUS = [
	{ label: '在线', value: 1 },
	{ label: '离线', value: 2 }
]

export const DELETE_STATUS = [
	{ label: '是', value: '1' },
	{ label: '否', value: '0' }
]

export const getSearchColumns = () => [
	{
		type: "input",
		placeholder: "模板名称",
		name: "name"
	},
	{
		type: "input",
		placeholder: "模板地址",
		name: "url",
	},
	{
		type: "select",
		placeholder: "能否删除",
		name: "beDeleted",
		options: DELETE_STATUS
	},
]


export const getCreateColumns = () => {
	return [
		{
			type: "input",
			placeholder: "模板名称",
			label: "模板名称",
			name: "name",
			rules: [{ required: true, message: '这是必填项' }]
		},
		{
			type: "input",
			placeholder: "模板地址",
			label: "模板地址",
			name: "url",
			rules: [
				{ required: true, message: '这是必填项' },
			]
		},
		{
			type: "select",
			placeholder: "能否删除",
			label: "能否删除",
			name: "beDeleted",
			rules: [
				{ required: true, message: '这是必填项' },
			],
			options: DELETE_STATUS
		},
		{
			type: "input",
			placeholder: "备注",
			label: "备注",
			name: "remark",
			rules: [{ required: true, message: '这是必填项' }]
		},
	]
}